<template>
  <div>
	  <div>
	  <el-form :model="form" ref="form" :rules="rules" label-width="100px">
		  <el-form-item label="用户名" prop="userName" required>
			  <el-input v-model="form.userName"></el-input>
		  </el-form-item>
		  <el-form-item label="密码：" required>
		    <el-input v-model="form.password"></el-input>
		  </el-form-item>
		  <el-form-item label="真实姓名：" prop="realName"   required>
		    <el-input v-model="form.realName"></el-input>
		  </el-form-item>
		  <el-form-item label="年龄：">
		    <el-input v-model="form.age"></el-input>
		  </el-form-item>
		  <el-form-item label="性别：" style="width: 300px;">
		    <el-select v-model="form.sex" placeholder="性别" clearable>
		      <el-option v-for="item in sexEnum"
		  					 :key="item.key" :value="item.key" :label="item.value"></el-option>
		    </el-select>
		  </el-form-item>	
		  <el-form-item label="出生日期：" style="width: 300px;">
		    <el-date-picker v-model="form.birthDay" type="date" placeholder="选择日期" />
		  </el-form-item>
		  <el-form-item label="手机：">
		    <el-input v-model="form.phone"></el-input>
		  </el-form-item>
		  <el-form-item label="班级：" prop="userLevel" required style="width: 300px;">
		    <el-select v-model="form.userLevel" placeholder="班级">
		      <el-option v-for="item in levelEnum" :key="item.key" :value="item.key" :label="item.value"></el-option>
		    </el-select>
		  </el-form-item>
		  <el-form-item>
		    <el-button type="primary" @click="submitForm">提交</el-button>
		    <el-button @click="resetForm">重置</el-button>
		  </el-form-item>
	  </el-form>
	  </div>
   </div>
</template>

<script>
	export default{
		data () {
		  return {
		    form: {
		      id: null,
		      userName: '',
		      password: '',
		      realName: '',
		      role: 1,
		      status: 1,
		      age: '',
		      sex: '',
		      birthDay: null,
		      phone: null,
		      userLevel: null
		    },
		    formLoading: false,
		    rules: {
		      userName: [
		        { required: true, message: '请输入用户名', trigger: 'blur' }
		      ],
		      realName: [
		        { required: true, message: '请输入真实姓名', trigger: 'blur' }
		      ],
		      userLevel: [
		        { required: true, message: '请选择年级', trigger: 'change' }
		      ]
		    }
		  }
		},
	
	created(){
		let id = this.$route.query.id
		let _this = this
		if (id && parseInt(id) !== 0) {
		
		
		
		
		
		}
	},
	methods:{
		resetForm () {
		  this.$refs['form'].resetFields()
		},
	}
	}
</script>

<style>
</style>
